var jwt = require('jsonwebtoken');

var secretKey = 'XHY BiYeSheJi';

module.exports = function (userInfo) {
  if (userInfo.type == 'admin2_account') {
    return jwt.sign({id: userInfo.id, name: userInfo.name, type: userInfo.type, society_id: userInfo.society_id}, secretKey, {expiresIn: '48h'})
  }
  return jwt.sign({id: userInfo.id, name: userInfo.name,type:userInfo.type,society_id:'0'}, secretKey, {expiresIn: '48h'})
}